package se.com.movie.reader.model;

import java.util.Collections;
import java.util.SortedSet;
import java.util.TreeSet;

public class Settings {
	public static final String SETTINGS_FILE = "settings.xml";
	public static final String DEFAULT_TARGET_FILE = "movies.xml";
	public static final String[] DEFAULT_FILE_EXTIONSIONS = { "avi", "mkv", "mp4" };
	private static Settings mSettings = null;
	protected SortedSet<Extension> mExtensions = Collections.synchronizedSortedSet(new TreeSet<Extension>());
	public static String OUTPUT_FILENAME = null;

	private Settings() {
	}

	public static Settings getInstance() {
		if (mSettings == null) {
			mSettings = new Settings();
		}
		return mSettings;
	}

	public boolean search(Extension extension) {
		return mExtensions.contains(extension);
	}

	public static String getFilename() {
		return OUTPUT_FILENAME;
	}

	protected SortedSet<Extension> getExtensions() {
		return mExtensions;
	}

	public void addExtension(String extension) {
		if (!mExtensions.contains(extension)) {
			mExtensions.add(new Extension(extension));
		}
	}
}
